package fudan.se.project.domain.message;

import fudan.se.project.domain.User;
import lombok.Data;

import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import java.util.Date;

@MappedSuperclass

@Data
public abstract class Message {

    @ManyToOne
    private final User sender;
    @ManyToOne
    private final User receiver;

    private Date dateCreated;


    protected Message() {
        this.sender = null;
        this.receiver = null;
        this.dateCreated = new Date();
    }

    protected Message(User sender, User receiver) {
        this.sender = sender;
        this.receiver = receiver;

        this.dateCreated = new Date();
    }


}
